const express = require('express');
const { auth, authorize } = require('../../middleware/auth'); // 修正路径：middlewares -> middleware
const dashboardController = require('../../controllers/dashboard.controller');
// 如果需要参数验证，也在此引入
// const validate = require('../../middleware/validate'); // 对应修正路径
// const dashboardValidation = require('../../validators/dashboard.validation'); // 假设有此文件

const router = express.Router();

router.post(
  '/user-summary-stats',
  auth(), // 先验证登录
  authorize(['viewDashboardStats']), // 再验证权限，确保 'viewDashboardStats' 在角色配置中存在
  // 如果有请求体验证，会放在这里: validate(dashboardValidation.getUserSummaryStatsSchema),
  dashboardController.getUserSummaryStats
);

module.exports = router; 